
#include <stdio.h>
#include <unistd.h>
#include "../compile_bsp/system.h"
#include "noc.h"


unsigned int buffer [BUFFER_SIZE];

#define DES_X	3
#define DES_Y	1
#define DES_ADDR core_addr(DES_X, DES_Y) 		


void delay(unsigned int count) {

	while(count) count--;

}



int main()
{

 while(1){
	unsigned int status=0;
	int i;
	
	while (!(status & NIC_HAS_PCK_LOC)) status = *nic_st_ptr ;
	 *led_ptr = 0xFFFF;
	 *nic_rd_ptr= (unsigned int) (&buffer[0]) + (BUFFER_SIZE<<19);
	while (!(status & NIC_RD_DONE_LOC)) status = *nic_st_ptr ;
//process	
	for (i=1;i<15;i++) {
		buffer [i] = buffer [i]*2;
	}




	buffer [0]= DES_ADDR ;
	*nic_wr_ptr = (unsigned int) (&buffer[0]) + (BUFFER_SIZE<<19);
	while (!(status & NIC_WR_DONE_LOC)) status = *nic_st_ptr ;

	// usleep(1000000);
	 *led_ptr = 0x0000;
	 //usleep(1000000);


 }






  return 0;
}
